package com.bj.zspace.excel;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

public class UserMap {
    public static void main(String[] args) throws Exception {

        Set<String> user = new HashSet<>();

        // 文件路径（替换为你的txt文件路径）
        String filePath = "/Users/tyc/b.txt";
        int lineNum = 0;
        boolean first = true;
        // 使用 try-with-resources 自动关闭流（Java 7+），无需手动调用 close()
        try (BufferedReader br = new BufferedReader(new FileReader(filePath))) {
            String line; // 存储每行内容
            // 循环读取，直到 readLine() 返回 null（表示文件结束）
            while ((line = br.readLine()) != null) {
                if (first) {
                    first = false;
                    continue;
                }
                if (line == null || line.trim().isEmpty()) {
                    first = false;
                    continue;
                }
                String[] split = line.split("\t");
                if (split.length != 3) {
                    continue;
                }
                user.add(split[2]);
            }
        }
        String userStr = user.stream().collect(Collectors.joining(","));
        System.out.println(userStr);
    }
}
